package org.xi.structural.proxy.dynamic;

import org.xi.structural.proxy.dynamic.api.Image;
import org.xi.structural.proxy.dynamic.handler.ImageHandler;

import java.lang.reflect.Proxy;

/**
 * java 动态代理
 */
public class Main {

    public static void main(String[] args) {
        Image image = (Image) Proxy.newProxyInstance(Image.class.getClassLoader(), new Class<?>[] {Image.class}, new ImageHandler());
        image.displayImage();
        System.out.println(image.getName());
    }
}
